/*================================================================
*   File Name：public.c
*   Mail: a1277992967@163.com 
*   blog: http://www.ycst.club/suggest/ 
*   Author：ycst
*   Created Time：2022年08月15日 星期一 13时54分24秒
*   Describe：
*
================================================================*/

#include "../include/public.h"
#include "../include/common.h"
/*
 *	@describe:	回调函数，获取Cmd结构体值
 *	@parameter:	
 *	@recv_buf:	要解析的数组
 *	@unsigned char(*fun)(char *recv_buf)):	函数名称
 */
unsigned char get_value(char *recv_buf, unsigned char(*fun)(char *recv_buf)){
	return fun(recv_buf);
}

unsigned char head(char *recv_buf){
	Cmd *cmd = (Cmd *)recv_buf;
	return cmd->head;
}

unsigned char devID(char *recv_buf){
	Cmd *cmd = (Cmd *)recv_buf;
	return cmd->devID;
}

unsigned char devType(char *recv_buf){
	Cmd *cmd = (Cmd *)recv_buf;
	return cmd->devType;
}

unsigned char majorCmd(char *recv_buf){
	Cmd *cmd = (Cmd *)recv_buf;
	return cmd->majorCmd;
}

unsigned char minCmd(char *recv_buf){
	Cmd *cmd = (Cmd *)recv_buf;
	return cmd->minCmd;
}

unsigned char cmdVal(char *recv_buf){
	Cmd *cmd = (Cmd *)recv_buf;
	return cmd->cmdVal;
}

unsigned char reserve1(char *recv_buf){
	Cmd *cmd = (Cmd *)recv_buf;
	return cmd->reserve1;
}

unsigned char reserve2(char *recv_buf){
	Cmd *cmd = (Cmd *)recv_buf;
	return cmd->reserve2;
}

unsigned char tail(char *recv_buf){
	Cmd *cmd = (Cmd *)recv_buf;
	return cmd->tail;
}
